/**
 * Created by dukes on 2015/11/4.
 */
class ContributionPanel extends eui.Component{
    public constructor(){
        super();
        this.skinName = "skins.scene.ContributionSkin";
        this.addEventListener(egret.Event.ADDED_TO_STAGE,this.addedToStage, this );
        this.addEventListener(egret.Event.REMOVED_FROM_STAGE, this.removedFromStage, this);
    }
    private addedToStage(evt:egret.Event){
        window["__popularityRank"]();
    }
    private removedFromStage(evt:egret.Event){
    }
    public partAdded(name:string, instance:any) {
        super.partAdded(name, instance);
        if (name == "group_week_popu") {
            this.group_week_popu = instance;
        } else if (name == "group_total_popu") {
            this.group_total_popu = instance;
        } else if (name == "itemlist") {
            this.itemlist = instance;
            this.itemlist.itemRenderer = PopulationItemRender;
            this.listProvider = new eui.ArrayCollection();
            this.itemlist.dataProvider = this.listProvider;
        }
    }
    private listProvider:eui.ArrayCollection;
    public onContributeListBack(list:any[],populayrity){
        this.listProvider.source = list;
        this.group_week_popu.text = populayrity.weekPopularity+"";
        this.group_total_popu.text = populayrity.popularity+"";
        //GetUIAssetsNum(populayrity.weekPopularity,this.group_week_popu);
        //GetUIAssetsNum(populayrity.popularity,this.group_total_popu);
    }
    public group_week_popu:eui.BitmapLabel;
    public group_total_popu:eui.BitmapLabel;
    public itemlist:eui.List;
    private static _instance:ContributionPanel;
    public static getInstance():ContributionPanel{
        if( ContributionPanel._instance == null )
            ContributionPanel._instance = new ContributionPanel();
        return ContributionPanel._instance;
    }
}